<%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Wheels.TransitService.MetroStationPredictionObject>>" %>
<%@ Import Namespace="Wheels.TransitService" %>
<div id="TrainPredictions" title="Station Prediction" class="panel">
    <%
    var stop = this.ViewData["stop"] as StopObject;
    var StationName = stop != null ? stop.Name : "Unknown Station";
    %>
    <h2><%= StationName%></h2>    
    <% 
        if (this.Model.Count() == 0)
        {%>
            <ul class="trainPrediction">
            <li>&nbsp;</li>
            <li style="padding: 15px 4px 15px 16px;font-weight:bold;">
                <span class="t_destination">No Information</span>
            </li>
            <li>&nbsp;</li>
          </ul>
        <%}
        else
        {
            foreach (var group in this.Model.GroupBy(p => p.Group))
            {
        %>
     <ul class="trainPrediction">
     <li>&nbsp;</li>
     <%
        if (group.Count() != 0)
        {
            foreach (var train in group)
            {                
             %>
        <li>
            <a id="lineInfo" href="/Transit/LineInfo?color=<%=train.Line%>&stopId=<%=train.StationCode%>&destinationCode=<%=train.DestinationCode%>">
                <span class='t_destination line_<%= train.Line.ToLower() %>'><%= train.DestinationDisplayName%></span>
                <%if (train.MinutesNumber.HasValue && train.MinutesNumber.Value >= 0)
                {%>
                    <span class="t_departure"> <%= train.MinutesNumber.Value%> min.</span>                    
                    <%}
                else
                {%>
                    <span class="t_departure"><%= train.Minutes%></span>
                <%}%>
            </a>
         </li>
      <%}
        }
        else
        {%>
         <li style="padding: 15px 4px 15px 16px;font-weight:bold;">
            <span class="t_destination">No Information</span> 
         </li>
         <%}
      %>
      <li>&nbsp;</li>
      </ul>   
      <%
        }
       } %>
      <% Html.RenderPartial("Footer");%>
</div>
